import { request } from '@/utils/http'
import {
    getHosListSearchParamsType,
    hospitalListReqReturnType,
    getProvinceReturnType,
    hosDetailReturnType,
    hosDepartmentListType,
    hosScheduleRuleParamsType,
    hosScheduleRuleReturnType,
    findScheduleListParamsType,
    findScheduleListReturnType
} from './model/hospitalListType'

// 医院列表请求api设置(设置请求参数的类型以及返回值类型)
export const getHosListRequest=(page:number,limit:number,searchParams:getHosListSearchParamsType)=>{
    return request.get<any,hospitalListReqReturnType>(`/admin/hosp/hospital/${page}/${limit}`,{
        params:searchParams
    })
}

// 医院省份数据api请求
export const getHosProvinceRequest=()=>{
    return request.get<any,getProvinceReturnType>("/admin/cmn/dict/findByDictCode/province")
}

// 医院市级数据api请求
export const getHosCityRequest=(value:string)=>{
    return request.get<any,getProvinceReturnType>(`/admin/cmn/dict/findByParentId/${value}`)
}

// 医院请求详情数据api
export const getHosListDetaRequest=(id:string)=>{
    return request.get<any,hosDetailReturnType>(`/admin/hosp/hospital/show/${id}`)
}

// 医院上下线的api请求
export const changeStatusRequest=(id:string,status:0|1)=>{
    return request.get<any,null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}

// 医院所有科室排班数据的api请求
export const hosDepartmentDataRequest=(hoscode:string)=>{
    return request.get<any,hosDepartmentListType>(`/admin/hosp/department/${hoscode}`)
}

// 医院所有科室排班时间的api请求
export const hosScheduleRuleRequest=({ page, limit, hoscode, depcode }:hosScheduleRuleParamsType)=>{
    return request.get<any,hosScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

// 获取某个科室某个时间的具体详情数据api接口
export const getDepartmentWorkDataRequest=({hoscode,depcode,workDate}:findScheduleListParamsType)=>{
    return request.get<any,findScheduleListReturnType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}